package goi_1;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.Assert;
import org.junit.Test;

public class testCoffeeReceipt extends TestCase {

	@Test
	public void test() {
		new CoffeeReceipt("Trung Nguyen", 15.95, 100);
		new CoffeeReceipt("Tay Nguyen", 8.00, 1000);
		new CoffeeReceipt("Bac Nguyen", 9.5, 1700);

	}

	public void testSellingCost() {
		CoffeeReceipt e1 = new CoffeeReceipt("Trung Nguyen", 15.95, 100);
		Assert.assertEquals(e1.sellingCost(), 1595, 0.001);

		CoffeeReceipt e2 = new CoffeeReceipt("Tay Nguyen", 8.00, 1000);
		Assert.assertEquals(e2.sellingCost(), 8000, 0.001);

		CoffeeReceipt e3 = new CoffeeReceipt("Bac Nguyen", 9.5, 1700);
		Assert.assertEquals(e3.sellingCost(), 16150, 0.001);
	}

	public void testWeightMoreThan() {
		CoffeeReceipt e1 = new CoffeeReceipt("Trung Nguyen", 15.95, 100);
		assertFalse(e1.weightMoreThan(150.0));
		CoffeeReceipt e2 = new CoffeeReceipt("Tay Nguyen", 8.00, 1000);
		assertFalse(e2.weightMoreThan(1050.0));
		CoffeeReceipt e3 = new CoffeeReceipt("Bac Nguyen", 9.5, 1700);
		assertTrue(e3.weightMoreThan(1650.0));

	}

	public void testCheaper() {
		CoffeeReceipt e1 = new CoffeeReceipt("Trung Nguyen", 15.95, 100);
		assertFalse(e1.cheaper(15.0));
		CoffeeReceipt e2 = new CoffeeReceipt("Tay Nguyen", 8.00, 1000);
		assertTrue(e2.cheaper(8.5));
		CoffeeReceipt e3 = new CoffeeReceipt("Bac Nguyen", 9.5, 1700);
		assertTrue(e3.cheaper(10));

	}
}